import requests


class IHRMMangageEnpApi:
    #定义添加员工接口
    @classmethod
    def add_emp(cls, token,data):
        url = "http://ihrm-test.itheima.net/api/sys/user"
        hearder = {"Content-Type": "application/json", "Authorization": token}
        resp= requests.post(url=url, headers=hearder, json=data)
        return resp
    #查询员工接口
    @classmethod
    def quer_emp(cls,emp_id,token):
        url = "http://ihrm-test.itheima.net/api/sys/user/"+emp_id
        hearder = {"Authorization": token}
        resp = requests.get(url=url, headers=hearder)
        return resp
    #修改员工接口
    @classmethod
    def modfiy_emp(cls,emp_id,token,data):
        url = "http://ihrm-test.itheima.net/api/sys/user/"+emp_id
        hearder = {"Content-Type": "application/json",
                   "Authorization": token}
        resp= requests.put(url=url, headers=hearder, json=data)
        return resp
    #删除员工接口
    @classmethod
    def del_emp(cls,emp_id,token):
        url = "http://ihrm-test.itheima.net/api/sys/user/"+emp_id
        hearder = {"Authorization": token}
        resp = requests.delete(url=url, headers=hearder)
        return resp
